package com.zoro.barn.commons.mongodb.property;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author zhaoxingwu
 */
@ConfigurationProperties(prefix = "barn.mongo")
public class BarnMongoProperties {

    public static final String HOST_SP = ",";
    public static final int DEFAULT_PORT = 27017;

    private String host = "localhost";
    private String password;
    private String authDb = "admin";
    private String userName;
    private long selectionTimeout = 5000;
    private int port = DEFAULT_PORT;
    private int connectionTimeout = 5000;
    private int readTimeout = 5000;

    // about poll
    private int maxSize = 100;
    private int minSize = 5;
    private long maxWait = 5000;
    private boolean cluster = false;
    private String hosts ;
    private String ports ;

    public String getHosts() {
        return hosts;
    }

    public void setHosts(String hosts) {
        this.hosts = hosts;
    }

    public String getPorts() {
        return ports;
    }

    public void setPorts(String ports) {
        this.ports = ports;
    }

    public boolean isCluster() {
        return cluster;
    }

    public void setCluster(boolean cluster) {
        this.cluster = cluster;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public int getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(int maxSize) {
        this.maxSize = maxSize;
    }

    public int getMinSize() {
        return minSize;
    }

    public void setMinSize(int minSize) {
        this.minSize = minSize;
    }

    public long getMaxWait() {
        return maxWait;
    }

    public void setMaxWait(long maxWait) {
        this.maxWait = maxWait;
    }

    public int getConnectionTimeout() {
        return connectionTimeout;
    }

    public void setConnectionTimeout(int connectionTimeout) {
        this.connectionTimeout = connectionTimeout;
    }

    public int getReadTimeout() {
        return readTimeout;
    }

    public void setReadTimeout(int readTimeout) {
        this.readTimeout = readTimeout;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAuthDb() {
        return authDb;
    }

    public void setAuthDb(String authDb) {
        this.authDb = authDb;
    }

    public long getSelectionTimeout() {
        return selectionTimeout;
    }

    public void setSelectionTimeout(long selectionTimeout) {
        this.selectionTimeout = selectionTimeout;
    }

    public int getPort() {
        return port;
    }

    public void setPort(int port) {
        this.port = port;
    }

    @Override
    public String toString() {
        return "BarnMongoProperties{" +
                "host='" + host + '\'' +
                ", password='" + password + '\'' +
                ", authDb='" + authDb + '\'' +
                ", selectionTimeout=" + selectionTimeout +
                ", port=" + port +
                ", connectionTimeout=" + connectionTimeout +
                ", readTimeout=" + readTimeout +
                '}';
    }
}
